<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <!-- <script src="https://unpkg.com/vue@2.6.11/dist/vue.js"></script> -->
    <style>
      #app {
        display: flex;
        flex-direction: column;
        align-items: center;
      }
      .html-container {
        background-color: lightseagreen;
        padding: 10px;
        margin: 10px;
      }
    </style>
    <script>
      function onChangeState(e) {
        console.log(e);
      }
    </script>
  </head>

  <body>
    <div id="app">
      <div>
        <p>{{title}}</p>
        <p>{{message}}----{{code}}</p>
      </div>
      <div data-src="src" v-text="logger"></div>
      <!-- <div  class="html-container" v-html="source" v-on:mouseover="mouseover('测试参数')"></div> -->
      <div
        class="html-container"
        v-html="source"
        v-on:mouseover="mouseover('logger')"
      ></div>
      <div>
        <p>姓名 : {{ person.name }}</p>
        <p>性别 : {{ person.sex }}</p>
        <p>年龄 : {{ person.age }}</p>
        <p>工作 : {{ person.core.work }}</p>
      </div>
      <!-- <div>
        <span>输入姓名:</span>
        <input type="text" v-model="person.name" />
      </div> -->
      <div>
        <span>输入数据:</span>
        <input type="text" v-model="logger" v-on:change="stateChange" />
      </div>
      <div>
        <p>自定义事件--参数设置</p>
        <button v-on:click="fnCallback(person,message)">点击按钮</button>
      </div>
      <div>
        <p>监听Change事件</p>
        <input type="text" v-on:change="stateChange" />
      </div>
    </div>
    <script src="./scripts/utils.js"></script>
    <script src="./scripts/watcher.js"></script>
    <script src="./scripts/compiler.js"></script>
    <script src="./scripts/observer.js"></script>
    <script src="./scripts/vue.js"></script>
    <script>
      // v-text解决差值表达式闪烁问题
      const app = new Vue({
        el: "#app",
        data: {
          title: "This is A Simple Vue Project",
          message: "vue是什么?",
          logger: "20kB min+gzip 运行大小",
          source: `<div class="point">
                    <h2>易用</h2>
                    <p>已经会了 HTML、CSS、JavaScript？即刻阅读指南开始构建应用！</p>
                  </div>`,
          code: "coding",
          person: {
            name: "陌客",
            sex: "男",
            age: 8,
            core: {
              work: "IT",
            },
          },
        },
        methods: {
          fnCallback(person,message) {
            this.logger = "正在输出信息...";
            console.log(person);
            console.log(message);
          },
          stateChange(e) {
            console.log(this.logger);
          },
          mouseover(params) {
            alert(params || "正在测试参数传递");
          },
        },
      });

      console.log(app);
    </script>
    <script src="./test/utils-e2e-html.js"></script>
  </body>
</html>
